1438C - Engineer Artem - CodeForces Solution


2-sat chinese remainder theorem constructive algorithms fft flows *2000

Please click on ads to support us..

C++ Code:

// Date: 2023-03-14 10:02:51
// Problem: C. Engineer Artem
// Contest: Codeforces - Codeforces Round 682 (Div. 2)
// URL: https://codeforces.com/problemset/problem/1438/C
// Memory Limit: 256 MB
// Time Limit: 1000 ms
// --------By WIDA--------

#include <bits/stdc++.h>
using namespace std;
namespace WIDA {
	using LL = long long;
	using PII = pair<LL, LL>;
	using TII = tuple<LL, LL, LL>;
	#define FOR(i,a,b) for (int i = (int)(a); i <= (int)(b); i ++)
	#define FOR2(i,a,b) for (int i = (int)(a); i <= (int)(b); i += 2)
	#define FORD(i,b,a) for (int i = (int)(a); i >= (int)(b); i --)
	#define ALL(a) a.begin(), a.end()
	#define rALL(a) a.rbegin(), a.rend()
	#define pb push_back
	#define fi first
	#define se second
	#define sz size()
	const LL INF = 0x3f3f3f3f3f3f3f3f;
	template <class... Args> void _(Args... args) {
	    auto _ = [&](auto x) { cout << x << " "; };
	    cout << "--->"; int arr[] = {(_(args), 0)...};
	    cout << "\n";
	}
	template <class T> void _i(T args) {
	    cout << "{";
	    for (auto i : args) cout << i << ", "; cout << "}\n";
	}
	template <class T> void _ii(T args) {
	    cout << "{"; 
	    for (auto [i, j] : args) cout << i << " " << j << ", ";
	    cout << "}\n";
	}
	template <class... Args> void __(Args... args) {
	    auto _ = [&](auto x) { cout << x << " "; };
	    int arr[] = {(_(args), 0)...}; cout << "\n";
	}
	#define int long long // Zmod要关闭
	#define endl "\n" // 交互题要关闭
	const int MOD = 998244353; // 看清楚每道题的 MOD
	const int N = 1e6 + 7; // 二维数组要修改 vector<vector<int> > a(n, vector<int> (m, 0));
}
using namespace WIDA;


bool Solve() {
	int n, m; cin >> n >> m;
	for (int i = 1; i <= n; ++ i) {
		for (int j = 1; j <= m; ++ j) {
			int x; cin >> x;
			if ((i + j) % 2 != x % 2) cout << x + 1 << " ";
			else cout << x << " ";
		}
		cout << endl;
	}
	return 0;
}
signed main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	
	int Task = 1;
	cin >> Task;
	for (int i = 1; i <= Task; ++ i) {
		Solve();
//		cout << (Solve() ? "YES" : "NO") << endl;
	}
	
	return 0;
}


Comments

Submit
0 Comments
More Questions

MATCHES Playing with Matches
HRDSEQ Hard Sequence
DRCHEF Doctor Chef
559. Maximum Depth of N-ary Tree
821. Shortest Distance to a Character
1441. Build an Array With Stack Operations
1356. Sort Integers by The Number of 1 Bits
922. Sort Array By Parity II
344. Reverse String
1047. Remove All Adjacent Duplicates In String
977. Squares of a Sorted Array
852. Peak Index in a Mountain Array
461. Hamming Distance
1748. Sum of Unique Elements
897. Increasing Order Search Tree
905. Sort Array By Parity
1351. Count Negative Numbers in a Sorted Matrix
617. Merge Two Binary Trees
1450. Number of Students Doing Homework at a Given Time
700. Search in a Binary Search Tree
590. N-ary Tree Postorder Traversal
589. N-ary Tree Preorder Traversal
1299. Replace Elements with Greatest Element on Right Side
1768. Merge Strings Alternately
561. Array Partition I
1374. Generate a String With Characters That Have Odd Counts
1822. Sign of the Product of an Array
1464. Maximum Product of Two Elements in an Array
1323. Maximum 69 Number
832. Flipping an Image